<!--# layout("/common/layout.html",{"jsBase":"/js/person/customerExtInfo/"}){ -->

<form class="layui-form layui-form-pane" id="addForm" enctype="multipart/form-data" lay-filter="editform">
    <input type="hidden" name="customerId" id="customerId">
    <br>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">老师姓名</label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <input type="text" name="customerName" id="customerName" autocomplete="off" class="layui-input" readonly>
                    </div>
                </div>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <button class="layui-btn"  type="button" id="btn">选择</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">老师头衔</label>
                <div class="layui-input-inline">
                    <input type="text" name="job" id="job" autocomplete="off" class="layui-input" lay-verify="required">
                </div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">个性签名</label>
                <div class="layui-input-inline"  style="width:512px">
                    <input type="text" name="sign" id="sign" autocomplete="off" class="layui-input" lay-verify="required">
                </div>
            </div>
        </div>
    </div>



    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">老师评级</label>
                <div class="layui-input-inline">
                    <select name="star" lay-verify="">
                        <option value="0">请选择</option>
                        <option value="1">一星</option>
                        <option value="2">二星</option>
                        <option value="3">三星</option>
                        <option value="4">四星</option>
                        <option value="5">五星</option>
                    </select>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">有直播权限</label>
                <div class="layui-input-inline">
                    <input type="radio" name="zhiboPower" value="1" title="是" checked="true">
                    <input type="radio" name="zhiboPower" value="0" title="否">
                </div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">老师推荐语</label>
                <div class="layui-input-block" style="width:512px">
                    <textarea name="brief" id="brief" placeholder="请输入" class="layui-textarea" lay-verify="required"></textarea>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">老师介绍</label>
                <div class="layui-input-block" style="width:320px">
                    <div id="wxin-contentDesc"></div>
                    <input type="hidden" name="introduce" id="introduce"/>
                </div>
                <!--<div class="layui-input-block" style="width:512px">-->
                    <!--<textarea name="introduce" id="introduce" placeholder="请输入" class="layui-textarea" lay-verify="required"></textarea>-->
                <!--</div>-->
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <layui:image id="workPicurl" tagName="工作照" tips="图片说明" lay-verify="required"/>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <layui:image id="dailyPicurl" tagName="生活照" tips="图片说明" lay-verify="required"/>
            </div>
        </div>
    </div>

    <layui:submitButtons id="addButton"/>

</form>

<script type="text/javascript"  src="${ctxPath}/plugins/ueditor/ueditor.config.js"></script>
<script type="text/javascript"  src="${ctxPath}/plugins/ueditor/ueditor.all.js"></script>
<script type="text/javascript"  src="${ctxPath}/plugins/ueditor/xiumi-ue-dialog-v5.js"></script>
<!--#} -->
<script>
    Common.initImage();
    layui.define(['form', 'laydate', 'table', 'customerExtInfoApi','rate'], function (exports) {
        var form = layui.form;
        var customerExtInfoApi = layui.customerExtInfoApi;
        var index = layui.index;
        var isNew = true;

        <!--# if(!(isEmpty(customerExtInfoJson))){  -->
        isNew = false;
        <!--# } -->
        var view = {
            init: function () {
                Lib.initGenrealForm($("#addForm"), form);
                this.initSubmit();
            },
            initSubmit: function () {
                $("#addButton").click(function () {
                    document.getElementById("introduce").value=UE.getEditor('wxin-contentDesc').getContent();
                    form.on('submit(form)', function () {
                        customerExtInfoApi.saveForm(isNew, $('#addForm'), function () {
                            parent.window.dataReload();
                            Common.info("保存成功");
                            Lib.closeFrame();
                        });
                    });
                });

                $("#addButton-cancel").click(function () {
                    Lib.closeFrame();
                });
            }

        }
        view.init();

        $(document).on('click','#btn',function() {
            var url = Common.ctxPath+"/person/customerExtInfo/indexTeacher.do";
            var teacher = layui.layer.open({
                title: "用户列表",
                type: 2,
                content:url,//弹出层页面
                // area: ['850px', '700px'],
                area: ['100%', '100%'],
                success:function () {

                }
            });
            layer.full(teacher);

        });

        <!--# if(!(isEmpty(customerExtInfoJson))){  -->
        var formJson = ${customerExtInfoJson};
        form.val("editform", formJson);

        ue.ready(function() {
            UE.getEditor('wxin-contentDesc').setContent(formJson.introduce);
        });

        $(".image-preview").each(function () {
            $(this).attr("src", formJson[$(this).attr("id")]);
        });
        $(".file_link").each(function () {
            var a = document.createElement('a');
            var aJq = $(a);
            aJq.html("下载文件");
            aJq.attr("href", formJson[$(this).attr("id")]);
            aJq.attr("target", "_blank");
            $(this).append(aJq);
        });
        <!--# } -->
    });

    function callback(data) {
        $("#customerName").val(data.customerName);
        $("#customerId").val(data.customerId)
    }


    let ueditor_config = {
        toolbars: [["undo", "redo", "|", "fontsize", "forecolor", "bold", "italic", "underline", "|", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "lineheight", "|", "directionalityltr", "directionalityrtl", "indent", "|", "spechars", "source", "|", "searchreplace", "|", "fullscreen","mobile"]],
        serverUrl: "${ctxPath}/content/resContentMain/config",
        autoHeightEnabled: false,
        elementPathEnabled : true,　　//是否启用元素路径，默认是true显示
        wordCount:false,          //是否开启字数统计
        initialFrameHeight:400,
        initialFrameWidth:850
    };

    var ue = UE.getEditor('wxin-contentDesc',ueditor_config);

</script>
